home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 3
/
Amoszine 3.adf
/
Celebrity_source
/
colour_fade.AMOS
/
colour_fade.amosSourceCode
Wrap
AMOS Source Code
|
1992-02-26
|
5KB
|
200 lines
' *************************************************************
'
' - ** Screen Fade Program ** -
'
' By Paul Nordovics
'
' If you use this in your own programs I won't be offended if
' you mention me in your creditz !!!
' *************************************************************
'
' _fade[speed,_step,c1,c2]
'
' speed = speed of fade (0 = fastest)
' _step = gap between each shade of colour
' c1 and c2 determine the colour of the fx
' c1 indicates which RGB component of colour 0 to reduce 1st
' c2 indicates which RGB component of colour 0 to reduce 2nd
' the component that is left is then reduced to 0
' components are numbered as follows:
' Red = 0
' Green = 1
' Blue = 2
' e.g. c1=0 c2=1
' reduce Red component of colour 0 to 0 first
' reduce Green component of colour 0 to 0 next
' reduce Blue component of colour 0 to 0 last
'
' best to try different combinations to see what's going on
'
' when proc is done all colour registers will = 0
' and the screen will be filled with colour 0 only
' -------------------------------------------------------------
'
' *************
' set up screen
' *************
Screen Open 0,320,256,32,Lowres
Curs Off : Flash Off : Hide
Cls 0 : Paper 0 : Pen 4
Locate ,10
Centre "- Press A Key -"
'
Wait Key
_FADE[1,6,2,1]
'
End
'
Procedure _FADE[SPEED,_STEP,C1,C2]
_COL_NUM=Screen Colour
R=15*256
G=15*16
B=15
Dim _COL_FLAG(_COL_NUM-1)
' *************
' fade to white
' *************
Repeat
If SPEED>0 Then Wait SPEED
For K=0 To _COL_NUM-1
C=Colour(K)
If C<$FFF
Add C,$111
If C>$FFF
C=$FFF
End If
End If
If C=$FFF and _COL_FLAG(K)=0
Add FLAG,1
_COL_FLAG(K)=1
End If
Colour K,C
Next K
Until FLAG=_COL_NUM
'
' ***********
' t'other bit
' ***********
' ***************************************
' this sets up the different colour areas
' ***************************************
For K=0 To _COL_NUM-1
O=K*_STEP
Cls K,O,O To 320-O,256-O
Next K
' ****************
' this is the fade
' ****************
Repeat
If SPEED>0 Then Wait SPEED
' *********************
' shift colours 1 => 15
' *********************
For K=_COL_NUM-1 To 1 Step -1
C=Colour(K-1)
Colour K,C
Next K
' *******************************
' work out new value for colour 0
' *******************************
' ****************
' reduce red first
' ****************
If C1=0
Add R,-256
If R<0
R=0
' *****************
' reduce 2nd choice
' *****************
If C2=1
Add G,-16
If G<0
G=0
Add B,-1
If B<0
B=0
End If
End If
End If
If C2=2
Add B,-1
If B<0
B=0
Add G,-16
If G<0
G=0
End If
End If
End If
End If
End If
' ******************
' reduce green first
' ******************
If C1=1
Add G,-16
If G<0
G=0
' *****************
' reduce 2nd choice
' *****************
If C2=0
Add R,-256
If R<0
R=0
Add B,-1
If B<0
B=0
End If
End If
End If
If C2=2
Add B,-1
If B<0
B=0
Add R,-256
If R<0
R=0
End If
End If
End If
End If
End If
' *****************
' reduce blue first
' *****************
If C1=2
Add B,-1
If B<0
B=0
If C2=0
Add R,-256
If R<0
R=0
Add G,-16
If G<0
G=0
End If
End If
End If
If C2=1
Add G,-16
If G<0
G=0
Add R,-256
If R<0
R=0
End If
End If
End If
End If
End If
P=R+G+B
Colour 0,P
Until Colour(_COL_NUM-1)=0
' ********************************************
' tidy up by filling screen with colour 0 only
' ********************************************
Cls 0
End Proc